<template>
  <div class="goodlist-wrap">
    <!-- 头部 -->
    <van-nav-bar title="标题" left-arrow fixed placeholder @click-left="onClickLeft" :border="false">
      <template #right>
        <van-icon name="search" size="18" />
      </template>
    </van-nav-bar>
    <!-- 导航 -->
    <van-tabs :ellipsis="show" title-active-color="#CF2553">
      <van-tab v-for="(item,index) in listTitle" :title="item" :key="index"></van-tab>
    </van-tabs>
    <!-- 排序 -->
    <div class="goodslist-content">
      <ul class="sort">
        <li  v-for="(item,index) in list" :key="index" @click="change(index)" :class="{color:index==isactive}">
          {{item}}
          <van-icon name="arrow-down" v-if="index==2" />
          <van-icon name="todo-list-o" v-if="index==3" />
        </li>
      </ul>
      <!-- 商品列表 -->
      <van-grid :column-num="2" >
        <van-grid-item v-for="index in 10" :key="index" to="/detail/:id">
          <van-image src="https://img.yzcdn.cn/vant/apple-1.jpg" />
          <p class="title">Lovey萌系小恶魔旅行箱（17寸）</p>
          <p class="price">￥999</p>
        </van-grid-item>
      </van-grid>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      isactive:0,        
      listTitle: ["全部", "美容电器", "美妆小物", "日化护理", "卫生护理"],
      show: false,
      list: ["新品", "销量", "价格",""],
    };
  },
  props: {},
  methods: {
    onClickLeft() {//点击左箭头退回分类页
      this.$router.go(-1);
    },
    change(index){
        this.isactive=index

    },
   
  },
  
};
</script>
<style lang="stylus" >
.goodlist-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;

  // 头部搜索框
  .van-nav-bar--fixed {
    height: 45px;
    background: #fff;
    z-index:10;

    .van-icon {
      color: #4e4e4e;
      font-size: 16px;
    }

    .van-nav-bar__title {
      font-size: 18px;
      color: #494949;
      line-height: 25px;
    }
  }

  // 导航栏
  .van-tabs__wrap--scrollable {
    border-bottom: 1px solid #ededed;
    height: 30px;
    width:100%;
    background: #fff;
    position: fixed;
    left: 0;
    z-index: 10;
    .van-tab{     
      font-size: 12px;
      font-family: PingFang-SC-Bold, PingFang-SC;
      font-weight: bold;
      color: #414141;
      line-height: 17px;
    }

    .van-tabs__line{
      height: 1px;
      width:36px;
      color:#c80032;
  }
  }
}
.goodslist-content{


ul {
  width: 100%;
  height: 34px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  left: 0;
  top: 75px;
  background: #fff;
  z-index: 10;

  li {
    font-size: 12px;
    font-family: PingFang-SC-Bold, PingFang-SC;
    font-weight: bold;
    color: #B8B8B8;
    line-height: 17px;
  
  }
  li:nth-child(4){
    font-size: 20px;   
  } 
}
 .color {
    color: #6c6c6c;
  }
}
.van-grid {
  margin-top: 57px;
  // height: 243px;

  .van-grid-item {
   
    .van-image {
      width: 94px;
      height: 148px;
      padding: 27px auto 0;

      img {
        width: 100%;
        height: 100%;
      }
    }
    .van-grid-item:nth-child(1),
    .van-grid-item:nth-child(2){
      border-top: none;

    }



    .title {
      font-size: 12px;
      font-family: PingFang-SC-Medium, PingFang-SC;
      font-weight: 500;
      color: #656565;
      line-height: 12px;
      margin: 16px 20px 0;
    }

    .price {
      font-size: 12px;
      font-family: PingFang-SC-Bold, PingFang-SC;
      font-weight: bold;
      color: #C90738;
      line-height: 17px;
      margin-left: -100px;
      margin-top: 3px;
    }
  }
}
</style>